﻿#pragma once

#include "precomp.h"
#include "global_state.h"
#include "player.h"

struct Replay_Frame{
	float time;
	
	float player_x;
	float player_y;
	float player_a; // focus angle
	char player_focus;
	char player_shot;
	char player_rapid;
	char player_spellcard_trigger;

	char player_keys;
};

class Replayer {
public:
	Replayer();
	void AddFrame(float time);
	void SaveReplay(CL_String filename);
	int LoadReplay(CL_String filename);
	void ClearReplay();
	void ResetReplay();
	void SetKeysPressed();

	Replay_Frame GetFrameData();
	bool NextFrame();

private:
	cl_ubyte64 current_frame;
	cl_ubyte64 frame_count;
	int keys_pressed;
	std::vector<Replay_Frame> frames;
};

extern Replayer replay;
